/*     */ package btsm.bean;
/*     */ 
/*     */ import java.io.PrintStream;
/*     */ import java.sql.ResultSet;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ 
/*     */ public class cablePage
/*     */ {
/*  16 */   String sqlCount = "";
/*  17 */   String sqlPage = "";
/*  18 */   int ShowPage = 1;
/*  19 */   int RowCount = 0;
/*  20 */   int PageCount = 0;
/*  21 */   int redundance = 0;
/*     */   public String HttpFile;
/*     */   String tablea;
/*     */   String ida;
/*  27 */   public String texta = null;
/*     */ 
/*  29 */   sqlCableWork sw = null;
/*     */ 
/*     */   public cablePage(String tableaa, String idaa)
/*     */   {
/*  33 */     this.tablea = tableaa;
/*  34 */     this.ida = idaa;
/*  35 */     swInit();
/*     */   }
/*     */ 
/*     */   private void swInit() {
/*  39 */     if (this.sw == null)
/*  40 */       this.sw = new sqlCableWork(this.tablea, this.ida);
/*     */   }
/*     */ 
/*     */   public void dbConClose() {
/*  44 */     if (this.sw != null)
/*  45 */       this.sw.dbConClose();
/*     */   }
/*     */ 
/*     */   public ResultSet myQuery(HttpServletRequest request, HttpServletResponse response, int PageType, int PageSize)
/*     */     throws Exception
/*     */   {
/*  51 */     swInit();
/*     */ 
/*  53 */     ResultSet rs = null;
/*  54 */     this.HttpFile = request.getRequestURI();
/*     */ 
/*  56 */     this.RowCount = this.sw.getCountPage();
/*     */ 
/*  58 */     this.redundance = (this.RowCount % PageSize);
/*  59 */     if (this.redundance == 0) {
/*  60 */       this.PageCount = (this.RowCount / PageSize);
/*     */     } else {
/*  62 */       this.PageCount = ((this.RowCount - this.redundance) / PageSize);
/*  63 */       this.PageCount += 1;
/*     */     }
/*  65 */     String ToPage = request.getParameter("ToPage");
/*  66 */     System.out.println("before ToPage:" + ToPage);
/*  67 */     if ((ToPage == null) || (!ToPage.matches("^[0-9]*$"))) {
/*  68 */       ToPage = "1";
/*     */     }
/*  70 */     System.out.println("ToPage:" + ToPage);
/*  71 */     this.ShowPage = Integer.parseInt(ToPage);
/*  72 */     if (this.ShowPage > this.PageCount) {
/*  73 */       this.ShowPage = this.PageCount;
/*     */     }
/*  75 */     if (this.ShowPage <= 0) {
/*  76 */       this.ShowPage = 1;
/*     */     }
/*     */ 
/*  79 */     rs = this.sw.scpage(this.ShowPage, PageSize);
/*  80 */     return rs;
/*     */   }
/*     */ 
/*     */   public ResultSet BlurQuery(HttpServletRequest request, HttpServletResponse response, int iType, int PageSize, String strFilter)
/*     */     throws Exception
/*     */   {
/*  86 */     swInit();
/*     */ 
/*  88 */     this.HttpFile = request.getRequestURI();
/*  89 */     this.RowCount = this.sw.getCountPageBQuery(strFilter);
/*     */ 
/*  91 */     this.redundance = (this.RowCount % PageSize);
/*  92 */     if (this.redundance == 0) {
/*  93 */       this.PageCount = (this.RowCount / PageSize);
/*     */     } else {
/*  95 */       this.PageCount = ((this.RowCount - this.redundance) / PageSize);
/*  96 */       this.PageCount += 1;
/*     */     }
/*  98 */     String ToPage = request.getParameter("ToPage");
/*  99 */     System.out.println("before ToPage:" + ToPage);
/* 100 */     if ((ToPage == null) || (!ToPage.matches("^[0-9]*$"))) {
/* 101 */       ToPage = "1";
/*     */     }
/* 103 */     System.out.println("FaultCableToPage:" + ToPage);
/* 104 */     this.ShowPage = Integer.parseInt(ToPage);
/* 105 */     if (this.ShowPage > this.PageCount) {
/* 106 */       this.ShowPage = this.PageCount;
/*     */     }
/* 108 */     if (this.ShowPage <= 0) {
/* 109 */       this.ShowPage = 1;
/*     */     }
/*     */ 
/* 112 */     return this.sw.BQuery(this.ShowPage, PageSize, iType, strFilter);
/*     */   }
/*     */ 
/*     */   public ResultSet BlurFQuery(HttpServletRequest request, HttpServletResponse response, int iType, int PageSize, String stroccode, String strFilter)
/*     */     throws Exception
/*     */   {
/* 118 */     swInit();
/*     */ 
/* 120 */     this.HttpFile = request.getRequestURI();
/* 121 */     this.RowCount = this.sw.getCountPageBFQuery(stroccode, strFilter);
/*     */ 
/* 123 */     this.redundance = (this.RowCount % PageSize);
/* 124 */     if (this.redundance == 0) {
/* 125 */       this.PageCount = (this.RowCount / PageSize);
/*     */     } else {
/* 127 */       this.PageCount = ((this.RowCount - this.redundance) / PageSize);
/* 128 */       this.PageCount += 1;
/*     */     }
/* 130 */     String ToPage = request.getParameter("ToPage");
/* 131 */     System.out.println("before ToPage:" + ToPage);
/* 132 */     if ((ToPage == null) || (!ToPage.matches("^[0-9]*$"))) {
/* 133 */       ToPage = "1";
/*     */     }
/* 135 */     System.out.println("ToPage:" + ToPage);
/* 136 */     this.ShowPage = Integer.parseInt(ToPage);
/* 137 */     if (this.ShowPage > this.PageCount) {
/* 138 */       this.ShowPage = this.PageCount;
/*     */     }
/* 140 */     if (this.ShowPage <= 0) {
/* 141 */       this.ShowPage = 1;
/*     */     }
/*     */ 
/* 144 */     return this.sw.BFQuery(this.ShowPage, PageSize, iType, stroccode, strFilter);
/*     */   }
/*     */ 
/*     */   public ResultSet myCableQuery(HttpServletRequest request, HttpServletResponse response, int PageType, int PageSize)
/*     */     throws Exception
/*     */   {
/* 151 */     swInit();
/*     */ 
/* 153 */     ResultSet rs = null;
/* 154 */     this.HttpFile = request.getRequestURI();
/*     */ 
/* 156 */     this.RowCount = this.sw.getCountPage();
/*     */ 
/* 159 */     this.redundance = (this.RowCount % PageSize);
/* 160 */     if (this.redundance == 0) {
/* 161 */       this.PageCount = (this.RowCount / PageSize);
/*     */     } else {
/* 163 */       this.PageCount = ((this.RowCount - this.redundance) / PageSize);
/* 164 */       this.PageCount += 1;
/*     */     }
/* 166 */     String ToPage = request.getParameter("ToPage");
/* 167 */     if ((ToPage == null) || (!ToPage.matches("^[0-9]*$"))) {
/* 168 */       ToPage = "1";
/*     */     }
/* 170 */     System.out.println("ToPage:" + ToPage);
/* 171 */     this.ShowPage = Integer.parseInt(ToPage);
/* 172 */     if (this.ShowPage > this.PageCount) {
/* 173 */       this.ShowPage = this.PageCount;
/*     */     }
/* 175 */     if (this.ShowPage <= 0) {
/* 176 */       this.ShowPage = 1;
/*     */     }
/*     */ 
/* 179 */     if (PageType == 0)
/* 180 */       rs = this.sw.scCablePage(this.ShowPage, PageSize);
/*     */     else {
/* 182 */       rs = this.sw.scCablePageByID(this.ShowPage, PageSize);
/*     */     }
/* 184 */     return rs;
/*     */   }
/*     */ 
/*     */   public ResultSet myCableFQuery(HttpServletRequest request, HttpServletResponse response, int PageType, int PageSize, String strFilter)
/*     */     throws Exception
/*     */   {
/* 190 */     swInit();
/*     */ 
/* 192 */     ResultSet rs = null;
/* 193 */     this.HttpFile = request.getRequestURI();
/*     */ 
/* 195 */     this.RowCount = this.sw.getCableCountPage(strFilter);
/*     */ 
/* 197 */     this.redundance = (this.RowCount % PageSize);
/* 198 */     if (this.redundance == 0) {
/* 199 */       this.PageCount = (this.RowCount / PageSize);
/*     */     } else {
/* 201 */       this.PageCount = ((this.RowCount - this.redundance) / PageSize);
/* 202 */       this.PageCount += 1;
/*     */     }
/* 204 */     String ToPage = request.getParameter("ToPage");
/* 205 */     System.out.println("before ToPage:" + ToPage);
/* 206 */     if ((ToPage == null) || (!ToPage.matches("^[0-9]*$"))) {
/* 207 */       ToPage = "1";
/*     */     }
/* 209 */     System.out.println("ToPage:" + ToPage);
/* 210 */     this.ShowPage = Integer.parseInt(ToPage);
/* 211 */     if (this.ShowPage > this.PageCount) {
/* 212 */       this.ShowPage = this.PageCount;
/*     */     }
/* 214 */     if (this.ShowPage <= 0) {
/* 215 */       this.ShowPage = 1;
/*     */     }
/*     */ 
/* 218 */     this.sw.wheresw = strFilter;
/*     */ 
/* 220 */     if (PageType == 0)
/* 221 */       rs = this.sw.scCableFPage(this.ShowPage, PageSize);
/*     */     else
/* 223 */       rs = this.sw.scCableFPageByID(this.ShowPage, PageSize);
/* 224 */     return rs;
/*     */   }
/*     */ 
/*     */   public ResultSet myUsersQuery(HttpServletRequest request, HttpServletResponse response, int PageType, int PageSize)
/*     */     throws Exception
/*     */   {
/* 230 */     swInit();
/*     */ 
/* 232 */     ResultSet rs = null;
/* 233 */     this.HttpFile = request.getRequestURI();
/*     */ 
/* 235 */     this.RowCount = this.sw.getUsersCountPage();
/*     */ 
/* 237 */     this.redundance = (this.RowCount % PageSize);
/* 238 */     if (this.redundance == 0) {
/* 239 */       this.PageCount = (this.RowCount / PageSize);
/*     */     } else {
/* 241 */       this.PageCount = ((this.RowCount - this.redundance) / PageSize);
/* 242 */       this.PageCount += 1;
/*     */     }
/* 244 */     String ToPage = request.getParameter("ToPage");
/*     */ 
/* 246 */     if ((ToPage == null) || (!ToPage.matches("^[0-9]*$"))) {
/* 247 */       ToPage = "1";
/*     */     }
/*     */ 
/* 250 */     System.out.println("ToPage:" + ToPage);
/* 251 */     this.ShowPage = Integer.parseInt(ToPage);
/* 252 */     if (this.ShowPage > this.PageCount) {
/* 253 */       this.ShowPage = this.PageCount;
/*     */     }
/* 255 */     if (this.ShowPage <= 0) {
/* 256 */       this.ShowPage = 1;
/*     */     }
/*     */ 
/* 259 */     return this.sw.scUsersPage(this.ShowPage, PageSize);
/*     */   }
/*     */ 
/*     */   public int getTotalPages()
/*     */   {
/* 265 */     return this.PageCount;
/*     */   }
/*     */ 
/*     */   public int getCurrenPages()
/*     */   {
/* 271 */     return this.ShowPage;
/*     */   }
/*     */ 
/*     */   public int getRowCount()
/*     */   {
/* 276 */     return this.RowCount;
/*     */   }
/*     */ 
/*     */   public String PageFooter(String strParam)
/*     */   {
/* 281 */     String str = "";
/*     */ 
/* 283 */     int prev = this.ShowPage - 1;
/* 284 */     int next = this.ShowPage + 1;
/*     */ 
/* 286 */     str = str + "查询到<span>" + getRowCount() + "</span>条记录" + 
/* 287 */       "    共<span>" + getTotalPages() + "</span>页";
/* 288 */     str = str + " 第<span>" + getCurrenPages() + "</span>页 ";
/* 289 */     if (this.ShowPage > 1)
/* 290 */       str = str + " <A href=" + strParam + "ToPage=1" + ">首页</A> ";
/*     */     else {
/* 292 */       str = str + " 首页 ";
/*     */     }
/* 294 */     if (this.ShowPage > 1)
/* 295 */       str = str + " <A href=" + strParam + "ToPage=" + prev + ">上一页</A> ";
/*     */     else {
/* 297 */       str = str + " 上一页 ";
/*     */     }
/* 299 */     if (this.ShowPage < this.PageCount)
/* 300 */       str = str + " <A href=" + strParam + "ToPage=" + next + ">下一页</A> ";
/*     */     else {
/* 302 */       str = str + " 下一页 ";
/*     */     }
/* 304 */     if ((this.PageCount > 1) && (this.ShowPage != this.PageCount))
/* 305 */       str = str + " <A href=" + strParam + "ToPage=" + this.PageCount + 
/* 306 */         ">尾页</A>";
/*     */     else {
/* 308 */       str = str + " 尾页 ";
/*     */     }
/* 310 */     str = str + "&nbsp;&nbsp;第<input name=ToPage type=text size=2>页 <input type=submit value=GO>";
/* 311 */     return str;
/*     */   }
/*     */ }

/* Location:           E:\java\apache-tomcat-6.0.36\webapps\btsm\WEB-INF\classes\
 * Qualified Name:     btsm.bean.cablePage
 * JD-Core Version:    0.6.2
 */